#include "filter.h"

/**
 * @brief 对输入点云进行下采样
 * 
 * @param cloud 
 * @return pcl::PointCloud<pcl::PointXYZ>::Ptr 
 */
pcl::PointCloud<pcl::PointXYZ>::Ptr downSampling(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud)
{
    //pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZ>);
    //pcl::VoxelGrid<pcl::PointXYZ> sor;
    //sor.setInputCloud(cloud);
    //sor.setLeafSize(0.01f, 0.01f, 0.01f);
    //sor.filter(cloud_filtered);
    //return cloud_filtered;
}

/**
 * @brief 去除距离过远的点云
 * 
 * @param cloud 
 * @return pcl::PointCloud<pcl::PointXYZ>::Ptr 
 */
pcl::PointCloud<pcl::PointXYZ>::Ptr remove_remote_layer(pcl::PointCloud<pcl::PointXYZ>::Ptr cloud)
{
    pcl::PointCloud<pcl::PointXYZ>::Ptr cloud_filtered(new pcl::PointCloud<pcl::PointXYZ>);
    pcl::PassThrough<pcl::PointXYZ> pass;
    pass.setInputCloud(cloud);
    pass.setFilterFieldName("z");
    pass.setFilterLimits(0.0, 1.0);
    pass.filter(*cloud_filtered);
    return cloud_filtered;
}